package org.jluzhCS.mylogin.action;

import org.jluzhCS.mylogin.domain.Book;

import ognl.DefaultTypeConverter;
import com.sun.javafx.collections.MappingChange.Map;

public class BookConverter extends DefaultTypeConverter
{
	public Object convertValue(Map context, Object value, Class toType)
	{
		/*if(toType == Book.class)
		{*/
			String[] params = (String[])value;
			Book book = new Book();
			String[] bookValues = params[0].split(",");
			book.setBookName(bookValues[0]);
			book.setBookAuthor(bookValues[1]);
			book.setBookPrice(bookValues[2]);
			return book;
		/*}
		else if(toType == String.class)
		{
			Book book = (Book)value;
			return "<" + book.getBookName() + "," +
					book.getBookAuthor() + "," +
					book.getBookPrice() + "<";
		}
		return book;*/
	}
}
